import { Form, Input, Button } from "antd";
import { Link } from "react-router-dom";
import { login } from "../../api/api";
import "./_style.scss";
const LoginForm = (props) => {
  const submit = data => {
    console.log(data);
    login(data).then(res => {
      props.onLogined(res);
    });
  };
  return (
    <div className="login_form">
      <h2>登录</h2>
      <Form name="login" onFinish={submit}>
        <Form.Item className="user_name item" label="手机号" name="phone">
          <div className="input_box">
            <Input />
          </div>
        </Form.Item>
        <Form.Item className="password item" label="密码" name="passWord">
          <div className="input_box">
            <Input.Password />
          </div>
        </Form.Item>
        <div className="btns">
          <Link to="/logon">
            <Button>注册</Button>
          </Link>
          <Button htmlType="submit">登录</Button>
        </div>
      </Form>
    </div>
  );
};

export default LoginForm;
